#define _CRT_SECURE_NO_WARNINGS
#include"Tree.h"
#include"Queue.h"
BTNode* CreatBinaryTree()
{
	BTNode* node1 = BuyNode(1);
	BTNode* node2 = BuyNode(2);
	BTNode* node3 = BuyNode(3);
	BTNode* node4 = BuyNode(4);
	BTNode* node5 = BuyNode(5);
	BTNode* node6 = BuyNode(6);
	BTNode* node7 = BuyNode(7);
	node1->left = node2;
	node1->right = node4;
	node2->left = node3;
	node4->left = node5;
	node4->right = node6;
	//node5->left = node7;
	node2->right = node7;
	return node1;
}
BTNode* CreateTree(char* a, int* pi) {
	if (a[*pi] == '#') {
		(*pi)++;
		return NULL;
	}
	BTNode* root = BuyNode(a[*pi]);
	(*pi)++;
	root->left = CreateTree(a, pi);
	root->right = CreateTree(a, pi);
	return root;
}
int main() {
	//BTNode* root = CreatBinaryTree();
	char a[100] = "ABD##E#H##CF##G##";
	int i = 0;
	BTNode* root = CreateTree(a, &i);
	PrevOrder(root);
	printf("\n");
	InOrder(root);
	printf("\n");
	NextOrder(root);
	printf("\n");
	BTreeSize(root);
	printf("BTreeSize: % d\n", BTreeSize(root));
	printf("BTreeSize: % d\n", BTreeSize(root));
	printf("BTreeLeaSize:%d\n", BTreeLeafSize(root));
	printf("BTreeLeaSize:%d\n", BTreeLeafSize(root));
	printf("BTreeLeveKSize:%d\n", BTreeLeveKSize(root, 3));
	printf("BTreeLeveKSize:%d\n", BTreeLeveKSize(root, 4));
	LevelOrder(root);
	printf("BinaryTreeComplete:%d\n", BinaryTreeComplete(root));
	root = NULL;
	return 0;
}